<?php

namespace App\Http\Requests\Cms;

use Illuminate\Foundation\Http\FormRequest;

class ConfigRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, mixed>
     */
    public function rules()
    {
        return [
            'sitename' => 'required|max:200',
            'description' => 'nullable|max:500',
            'person' => 'nullable|max:100',
            'phone' => 'required|regex:/^1[3456789]\d{9}$/',
            'email' => 'nullable|email|max:200',
            'address' => 'nullable|max:500',
        ];
    }
    public function attributes()
    {
        return [
            'sitename' => '项目名称',
            'description' => '项目介绍',
            'person' => '联系人',
            'phone' => '电话',
            'email' => '邮箱',
            'address' => '地址',
        ];
    }
}
